package com.hotelsystem.reservations.filter;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

import com.hotelsystem.reservations.rooms.Room;
import com.hotelsystem.reservations.rooms.RoomTypesEnum;

public class RoomFilterTest {
	
	private RoomFilter filter;

	@Before
	public void setup() {
		filter = new RoomFilter();
	}

	@Test
	public void isRoomFilterByNumberValidTest(){
		
		ArrayList<Room> roomList = new ArrayList<Room>();
//		filter.filterNumber(roomNumber, allRooms)
		Room room1 = new Room(9, RoomTypesEnum.TWO_PERSONS_ROOM , false);
		roomList.add(room1);
		Room room2 = new Room(11, RoomTypesEnum.PRESIDENTIAL_SUITE , true);
		roomList.add(room2);
		Room room3 = new Room(331, RoomTypesEnum.SUITE , true);
		roomList.add(room3);
		
		assertEquals("Checks whether room number is valid ", room1, filter.filterNumber(9, roomList));
		assertEquals("Checks whether room number is valid ", room2, filter.filterNumber(11, roomList));
		assertEquals("Checks whether room number is valid ", room3, filter.filterNumber(331, roomList));
		
	//	assertTrue("The age is expected to be valid ", validator.filterNumber(21, roomList));
	}
	
	@Test 
	public void isRoomFilterByRoomTypeValidTest(){
		
		ArrayList<Room> roomList = new ArrayList<Room>();
		
		Room room1 = new Room(9, RoomTypesEnum.PRESIDENTIAL_SUITE , false);
		roomList.add(room1);
		Room room2 = new Room(11, RoomTypesEnum.PRESIDENTIAL_SUITE , true);
		roomList.add(room2);
		Room room3 = new Room(331, RoomTypesEnum.SUITE , true);
		roomList.add(room3);
		
		ArrayList<Room> filteredRooms = new ArrayList<Room>();
		
		filter.filterRoomTypeAndIsSmokersFree(RoomTypesEnum.TWO_PERSONS_ROOM , true, roomList);
		
		for (Room room : filteredRooms) {
			assertEquals("Checks whether room type is valid ", RoomTypesEnum.TWO_PERSONS_ROOM, room.getRoomType());	
			//assertEquals("Checks whether room type is valid ",  RoomTypesEnum.PRESIDENTIAL_SUITE, room.getRoomType());
			//assertEquals("Checks whether room type is valid ", RoomTypesEnum.SUITE, room.getRoomType());
		}
		

	}
	
//	@Test
//	public void isRoomFilterByIsSmokersFreeValidTest(){
//		
//		ArrayList<Room> roomList = new ArrayList<Room>();
//		
//		Room room1 = new Room(9, RoomTypesEnum.TWO_PERSONS_ROOM , false);
//		roomList.add(room1);
//		Room room2 = new Room(11, RoomTypesEnum.PRESIDENTIAL_SUITE , true);
//		roomList.add(room2);
//		Room room3 = new Room(331, RoomTypesEnum.SUITE , true);
//		roomList.add(room3);
//		
//		assertTrue("Checks whether room number is valid ", false, room1.isSmokersFree());
//		assertTrue("Checks whether room number is valid ", true, room2.isSmokersFree());
//		assertTrue("Checks whether room number is valid ", true, room3.isSmokersFree());
//		
//	}
	
}
